import React from 'react';
import {Route,Redirect} from 'react-router-dom'
function fn(bol,props,Comp){
  console.log(props,Comp)
  return !bol?<Comp {...props} />:<Redirect to='/login'></Redirect>
}
class Protect extends React.Component {
    render() {
        let bol = localStorage.getItem('qqqwwweee')
        let {component:Comp,level,...others} =  this.props;
        // console.log(others,Comp)
        // 4 就是用户的level
        let userLevel = 4;
        return <>
          
          {/* {
            bol&&level <= userLevel?
            <Route component={Comp} path={this.props.path}></Route>:
            <Redirect to='/login'></Redirect>
          } */}
          <Route  {...others} render={(props)=>{
              return fn(bol,props,Comp)
          }}></Route>
        </>;
    }
}
export default Protect